//
//  ConstData.h
//  StoneMason
//
//  Created by iOS1 on 16/12/5.
//  Copyright © 2016年 iOS1. All rights reserved.
//

#ifndef ConstData_h
#define ConstData_h

//NSUserDefaults
//是否第一次登录
#define ISFIRSTLOGIN  @"isFirstLogin" // @"YES" @"NO"
#define APPVERSON   @"version"    //版本 NSString
#define HTTPNOERRO 0 // 等于0 请求成功
#define HAVEERRO  9999 // 有错误

//APPStore ID
#define APPSTOREID ""

//0 飞机 1游艇
#define ISYacht 1
 
//数据加密秘钥
#define Data_Secret_Key @"Bayue.FM"

//友盟 APPKey
#define UM_APPKEY           @"5a61a7bcf43e4823d80000df"

//微信 APPKey
#define WX_AppID @"wxbc219e97cb630e49"

//登录成功后,刷新用户信息
#define Notice_RefreshUserInfo @"refreshUserInfo"

//定位成功 刷新地图中心点
#define Notice_RefreshMapCenter @"refreshMapCenter"
//返回首页
#define Notice_BackHome @"backHome"

//刷新乘机人列表
#define Notice_RefreshPassengerList @"refreshPassengerList"

#pragma mark -- 常用颜色

#define VERSION [[UIDevice currentDevice].systemVersion doubleValue]
#define iOS8Later ([UIDevice currentDevice].systemVersion.floatValue >= 8.0f)

#define rgb(r,g,b,a) [UIColor colorWithRed:r/255.0f green:g/255.0f blue:b/255.0f alpha:a]

#define FONT(size)              [UIFont systemFontOfSize:size]
#define FONT_CUS(fontName,s)    [UIFont fontWithName:fontName size:s]
#define FONT_BOLD(size)         [UIFont boldSystemFontOfSize:size]

#define UIColorFromHex(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

#define SY_COLOR_CLEAR [UIColor clearColor]
#define COLOR_BACKGROUND UIColorFromHex(0xFAFAFA)
#define COLOR_LINE       UIColorFromHex(0xD6D6D6)
#pragma mark -- 常用颜色

#define COLOR_THEME_Green UIColorFromHex(0x54cc54)

#define COLOR_MAIN_BODY_BLACK UIColorFromHex(0x333333)
#define COLOR_Note_BLACK UIColorFromHex(0x666666)
#define COLOR_UNSELECTED UIColorFromHex(0x999999)
#define COLOR_CARD_BG UIColorFromHex(0xeeeeee)
#define COLOR_DIVIDING_LINE UIColorFromHex(0xcccccc)
#define COLOR_SECONDARY_ORANGE UIColorFromHex(0xf8b551)
#define COLOR_PROMPT_YELLOW UIColorFromHex(0xf13dd5)

#pragma mark - 尺寸常量

#define NavBarHeight 64
#define TabBarHeight 49

#define maskwidth WIDTHINIPHONE6(100)

#define ScreenWidth ([UIScreen mainScreen].bounds.size.width)
#define ScreenHight ([UIScreen mainScreen].bounds.size.height)
#define X(v) (v).frame.origin.x
#define Y(v) (v).frame.origin.y
#define WIDTH(v) (v).frame.size.width
#define HEIGH(v) (v).frame.size.height


#define ISIPHONE4S  ([UIScreen mainScreen].bounds.size.height == 480)
#define ISIPHONE5  ([UIScreen mainScreen].bounds.size.height == 568)
#define ISIPHONE6  ([UIScreen mainScreen].bounds.size.height == 667)
#define ISIPHONE6P  ([UIScreen mainScreen].bounds.size.height == 736)
#define ISIPHONEX  ([UIScreen mainScreen].bounds.size.height == 812)

#define WIDTHINIPHONE6(x)  ([UIScreen mainScreen].bounds.size.width * x / 375)
#define HEIGTHINIPHONE6(x) ([UIScreen mainScreen].bounds.size.height * x / 667)
#define WIDTHINIPHONE6P(x)  ([UIScreen mainScreen].bounds.size.width * x / 540)
#define HEIGTHINIPHONE6P(x) ([UIScreen mainScreen].bounds.size.height * x / 736)


#define DefineWeakSelf __weak __typeof(self) weakSelf = self

#define ALERT_MSG(msg) static UIAlertView *alert; alert = [[UIAlertView alloc] initWithTitle:nil message:msg delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];\
[alert show];\

// View 圆角和加边框
#define ViewBorderRadius(View, Radius, Width, Color)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:NO];\
[View.layer setBorderWidth:(Width)];\
[View.layer setBorderColor:[Color CGColor]]

// View 圆角
#define ViewRadius(View, Radius)\
\
[View.layer setCornerRadius:(Radius)];\
[View.layer setMasksToBounds:YES]

#define ViewBorderStyle(View,BorderWidth,BorderColor)\
\
View.layer.borderColor = BorderColor.CGColor;\
View.layer.borderWidth = BorderWidth

#pragma mark -- 网络接口

#if DEBUG  //测试服务器

#define Host @""

#define IMG_URL @"http://feima.bayuenet.com:8081"

#else  //正式服务器

#define Host @"http://feima.bayuenet.com:8081/index.php?s=home/api/inlet"

#define IMG_URL @"http://feima.bayuenet.com:8081"

#endif

#define APPStore_URL @""

#define UserInfo_Url @""

#endif /* ConstData_h */
